Skip to content

Serving: a champion can prewarm its market data before registration; crypto-1h warms first - #97

Merged
Thykof merged 1 commit into
mainfrom
feat/champion-prewarm
Nov 18, 2026
Merged

Thykof merged 1 commit into
mainfrom
feat/champion-prewarm

Conversation

@Thykof

@Thykof Thykof commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Why

A ChampionMiner fetches its minute history and the event calendar at each start, in a background thread, and refuses an asset's prompts (<ASSET> is still warming up) until that asset is in. With no stored calendar, every asset waits up to CALENDAR_WAIT_SECONDS (10 minutes). On a fresh volume this happens right after registration, so the first prompts are misses, and the validator scores each miss at the prompt's 95th percentile.

servable_assets() also listed the 24h competitions first, so the crypto-1h assets, prompted most often, were the last to come online.

What

  • ChampionMiner.prewarm(), a classmethod: one warm_up of every servable asset with the champion's context_days, then one calendar refresh, into MARKET_DATA_DIR. It needs no wallet and no chain, so it runs before the hotkey is registered. A miner started afterwards on the same volume fetches only the partitions not yet settled, and serves the stored calendar at once while it is under CALENDAR_MAX_AGE_SECONDS (24 h) old.
  • The calendar update moves to a module function, refresh_calendar(root), shared by prewarm() and the miner's daily refresh.
  • The generated miner.py and entrypoint.sh take --prewarm: champions/<name>/entrypoint.sh --prewarm fills market_data/ and exits.
  • servable_assets() orders the competitions by time_length, so on every start the crypto-1h assets warm up and serve first.

Tests

  • New:
    • prewarm() warms every servable asset with the class's context_days, then refreshes the calendar, without running Miner.__init__;
    • the 1h competition's assets come first in servable_assets();
    • the generated entrypoint runs miner.py --prewarm with a fake uv on PATH, and without the flag still starts the miner;
    • the generated miner.py prewarms with no wallet.
  • uv run pytest -q tests/serving: 66 passed, 1 skipped (as before). black 26.5.1 and flake8 clean.

Follow-up

synth-subnet's Terraform miner (synthdataco/synth-subnet#351) runs the same pre-warm through a small script against the synth-lib that autoquant pins today. Once autoquant pins a synth-lib with this change, it can call entrypoint.sh --prewarm instead.

🤖 Generated with Claude Code

…crypto-1h warms first

A ChampionMiner fetches its minute history and the event calendar at each
start, and refuses an asset's prompts until that asset is in. On a fresh
volume that happens after registration, so the first prompts fail.

ChampionMiner.prewarm() runs the same warm-up once, then one calendar
refresh, with no wallet and no chain. The generated miner.py and
entrypoint.sh take --prewarm for it. A miner started afterwards on that
volume fetches only the partitions not yet settled and serves the stored
calendar, so it answers almost at once.

servable_assets() now lists the shortest horizon's assets first, so on
every start the crypto-1h assets, prompted most often, are served first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@Thykof
Thykof merged commit aa57980 into main Nov 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant